Previous Book Contents Book Index Next

Inside Macintosh: Programming With the Text Encoding Conversion Manager /
Chapter 4 - Unicode Converter Reference / Unicode Converter Functions
Converting to Unicode /


CreateTextToUnicodeInfoByEncoding

Based on the given text encoding specification, creates and returns a Unicode converter object containing information required for converting strings from the specified non-Unicode encoding to Unicode.

pascal OSStatus CreateTextToUnicodeInfoByEncoding (
                     TextEncoding iEncoding,
                     TextToUnicodeInfo *oTextToUnicodeInfo);
iEncoding
The text encoding specification for the source text. For text encoding specifications, see Chapter 2, "Basic Text Types Reference."
oTextUnicodeInfo
The Unicode converter object of type TextToUnicodeInfo (page 119) returned by the function.
function result
A result code. See "Text Encoding Conversion Manager Result Codes" (page 42) in the chapter "Basic Text Types Reference."
DISCUSSION
This function offers you an easier, alternative way to create a Unicode converter than with the function CreateTextToUnicodeInfo (page 125) because you do not need to create a Unicode mapping structure. You simply specify the text encoding of the source text. However, this method is less efficient because the text encoding parameter must be resolved internally into a Unicode mapping.

Using this function, you cannot specify a version of Unicode, so a default version of Unicode is used; 16-bit format is assumed.

You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to the function ConvertFromTextToUnicode (page 129) or ConvertFromPStringToUnicode (page 163) to identify the information to be used for the conversion. These two functions modify the contents of the Unicode converter object.

You pass a Unicode converter object returned from CreateTextToUnicodeInfoByEncoding to the function TruncateForTextToUnicode (page 160) to identify the information to be used to truncate the string. This function does not modify the contents of the Unicode converter object.

If you are converting the text stream to Unicode as an intermediary encoding, and then from Unicode to the final destination encoding, you use the function CreateUnicodeToTextInfo (page 135) to create a Unicode converter object for the second part of the process.

SEE ALSO
CreateTextToUnicodeInfo (page 125)

"Text Encoding Base" (page 31)


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 NOV 1997